const { defineConfig } = require('@vue/cli-service')
const path = require('path')
module.exports = defineConfig({
  transpileDependencies: true,
  // 关闭eslint语法检查
  lintOnSave: false,
  css: {
    loaderOptions: {
      scss: {
        additionalData: `@import '@/assets/style/variables.scss';`,
      },
    },
  },
  chainWebpack(config) {
    // 关闭webpack默认对svg图标的处理
    config.module
      .rule('svg')
      .exclude.add(path.resolve(__dirname, 'src/icons'))
      .end()

    // 自己单独设置对svg图标的处理
    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(path.resolve(__dirname, 'src/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]',
      })
      .end()
  },
})
